﻿using Liang.Resource;
using Sunisoft.IrisSkin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Client
{
    static class Program
    {
        static readonly string m_AppKey = "A8F16CC2-FEFC-4BB6-98AD-637818E7C0E6";
        static Mutex m_OnlyOneApp = null;

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            // 获取版本号
            //CommonData.VersionNumber = Application.ProductVersion;

            bool bOpened = true;

            try
            {
                m_OnlyOneApp = Mutex.OpenExisting(m_AppKey);
            }
            catch (Exception e)
            {
                // 获取到任意一个异常，都说明尚未打开该应用程序
                // 否则，说明应用程序已经打开
                bOpened = false;
            }

            if (bOpened)
            {
                MessageBox.Show("程序已运行");
                System.Environment.Exit(1);
            }
            else
            {
                m_OnlyOneApp = new Mutex(true, m_AppKey);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(MainFrm.GetMainForm());
            }
        }
    }
}
